package com.gxa.controller;

import com.gxa.common.R;
import com.gxa.pojo.Goods;
import com.gxa.pojo.Supplier;
import com.gxa.pojo.Warehouse;
import com.gxa.service.QueryCommonService;
import com.gxa.service.impl.QueryCommonServiceImpl;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@Api(value = "常用查询",tags = "常用查询接口API")
public class QueryCommonController {
    @Autowired
    private QueryCommonService queryCommonService ;


    @RequestMapping(value = "/querySupplierList",method = RequestMethod.GET)
    @ApiOperation(value = "查询供应商接口",notes = "查询供应商", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "condition",value = "查询条件",paramType = "query"),
            @ApiImplicitParam(name = "supplier_Type_Name",value = "供应商类别",paramType = "query"),
            @ApiImplicitParam(name = "nowPage",value = "当前页",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页条数",paramType = "query")

    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R querySupplierList(String condition, String supplier_Type_Name,Integer nowPage,Integer pageSize){


        return queryCommonService.querySupplierList(condition,supplier_Type_Name,nowPage,pageSize);

    }

    @RequestMapping(value = "/queryCustomerList",method = RequestMethod.GET)
    @ApiOperation(value = "查询客户接口",notes = "查询客户", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "condition",value = "查询条件",paramType = "query"),
            @ApiImplicitParam(name = "customer_Type_Name",value = "客户类别",paramType = "query"),
            @ApiImplicitParam(name = "nowPage",value = "当前页",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页条数",paramType = "query")

    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryCustomerList(String condition, String customer_Type_Name,Integer nowPage,Integer pageSize){


        return queryCommonService.queryCustomerList(condition,customer_Type_Name,nowPage,pageSize);

    }

    @RequestMapping(value = "/querySupplierTypeList",method = RequestMethod.GET)
    @ApiOperation(value = "查询供应商类别接口",notes = "查询供应商类别", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R querySupplierTypeList(){
        return  queryCommonService.queerySupplierTypeList();
    }

    @RequestMapping(value = "/queryCustomerTypeList",method = RequestMethod.GET)
    @ApiOperation(value = "查询客户类别接口",notes = "查询客户类别", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryCustomerTypeList(){
        return  queryCommonService.queryCustomerTypeList();
    }

    @RequestMapping(value = "/queryGoodsList",method = RequestMethod.GET)
    @ApiOperation(value = "查询商品接口",notes = "查询商品", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "condition",value = "查询条件",paramType = "query"),
            @ApiImplicitParam(name = "nowPage",value = "当前页",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "每页条数",paramType = "query")

    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryGoodsList(String condition, Integer nowPage,Integer pageSize){


        return  queryCommonService.queryGoodsList(condition,nowPage,pageSize);
    }

    @RequestMapping(value = "/queryWorkhouseList",method = RequestMethod.GET)
    @ApiOperation(value = "查询仓库接口",notes = "查询仓库", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryWorkhouseList(){


        return  queryCommonService.queryWarehouseList();
    }
    @RequestMapping(value = "/queryInventory",method = RequestMethod.GET)
    @ApiOperation(value = "查询商品库存接口",notes = "查询商品库存", response = R.class)
    @ApiImplicitParam(name = "condition", value = "查询条件",  paramType = "query",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryInventory(String condition){


        return  queryCommonService.queryGoodsSave(condition);
    }
    @RequestMapping(value = "/queryAccount",method = RequestMethod.GET)
    @ApiOperation(value = "查询结算账户接口",notes = "查询结算账户库存", response = R.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")

    })
    @ResponseBody
    public R queryAccount(){

        return  queryCommonService.queryAccountList();
    }

    @RequestMapping(value = "/queryStaffList",method = RequestMethod.GET)
    @ApiOperation(value = "查询销售人员接口",notes = "查询销售人员库存", response = R.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")

    })
    @ResponseBody
    public R queryStaffList(){


        return  queryCommonService.queryStaffList();
    }

}
